package com.project.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.entity.SysStore;
import com.project.mapper.SysStoreMapper;
import com.project.service.ISysStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author wangsihan
 * @since 2021-10-08
 */
@Service
public class SysStoreServiceImpl extends ServiceImpl<SysStoreMapper, SysStore> implements ISysStoreService {

    @Autowired
    SysStoreMapper sysStoreMapper;

    /**
     * 根据用户id，查询当前登录用户下所有的商铺
     *
     * @return 商铺集合
     */
    @Override
    public List<SysStore> findUserIdByStore(Integer userId) {
        return sysStoreMapper.findUserIdByStore(userId);
    }

    /**
     * 根据商铺id，更改商铺的状态
     *
     * @param StoreId 商铺id
     * @param status  商铺状态
     * @return 是否更改成功
     */
    @Override
    public boolean updateStoreStatus(Integer StoreId, String status) {
        sysStoreMapper.updateStoreStatus(StoreId, status);
        return true;
    }
}
